home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 5 / osspascl / tsize.pas < prev    next >
Pascal/Delphi Source File  |  1985-11-19  |  4KB  |  119 lines

  1.  
  2. PROGRAM name ;
  3.  
  4.   CONST
  5.     {$I gemconst.pas}
  6.  
  7.   TYPE
  8.     {$I gemtype.pas}
  9.  
  10.   VAR
  11.     height : integer ;
  12.     s : Str255 ;
  13.  
  14.   {$I gemsubs.pas}
  15.  
  16.   { Text_Height - Set the height in pixels of text, when it is drawn using the
  17.       Draw_String library call. }
  18.  
  19.   PROCEDURE Text_Height( height : integer ) ;
  20.  
  21.     TYPE
  22.       Ctrl_Parms      = ARRAY [ 0..11 ] OF integer ;
  23.       Int_In_Parms    = ARRAY [ 0..15 ] OF integer ;
  24.       Int_Out_Parms   = ARRAY [ 0..45 ] OF integer ;
  25.       Pts_In_Parms    = ARRAY [ 0..11 ] OF integer ;
  26.       Pts_Out_Parms   = ARRAY [ 0..11 ] OF integer ;
  27.  
  28.     VAR
  29.       control : Ctrl_Parms ;
  30.       int_in  : Int_In_Parms ;
  31.       int_out : Int_Out_Parms ;
  32.       pts_in  : Pts_In_Parms ;
  33.       pts_out : Pts_Out_Parms ;
  34.  
  35.     PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
  36.                 VAR ctrl : Ctrl_Parms ;
  37.                 VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
  38.                 VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
  39.                 translate : boolean ) ;
  40.       EXTERNAL ;
  41.  
  42.     BEGIN
  43.       pts_in[0] := 0 ;
  44.       pts_in[1] := height ;
  45.       VDI_Call(12, 0, 0, 2, control, int_in, int_out, pts_in, pts_out, false);
  46.     END ;
  47.  
  48.   { Get_Height - Get the height in pixels of text, when it is drawn using the
  49.       Draw_String library call. }
  50.  
  51.   FUNCTION Get_Height : integer ;
  52.  
  53.     TYPE
  54.       Ctrl_Parms      = ARRAY [ 0..11 ] OF integer ;
  55.       Int_In_Parms    = ARRAY [ 0..15 ] OF integer ;
  56.       Int_Out_Parms   = ARRAY [ 0..45 ] OF integer ;
  57.       Pts_In_Parms    = ARRAY [ 0..11 ] OF integer ;
  58.       Pts_Out_Parms   = ARRAY [ 0..11 ] OF integer ;
  59.  
  60.     VAR
  61.       control : Ctrl_Parms ;
  62.       int_in  : Int_In_Parms ;
  63.       int_out : Int_Out_Parms ;
  64.       pts_in  : Pts_In_Parms ;
  65.       pts_out : Pts_Out_Parms ;
  66.  
  67.     PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
  68.                 VAR ctrl : Ctrl_Parms ;
  69.                 VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
  70.                 VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
  71.                 translate : boolean ) ;
  72.       EXTERNAL ;
  73.  
  74.     BEGIN
  75.       VDI_Call(131, 0, 0, 0, control, int_in, int_out, pts_in, pts_out, false);
  76.       Get_Height := pts_out[9] ;
  77.     END ;
  78.  
  79.  
  80.  
  81.   PROCEDURE wait_button ;
  82.  
  83.     VAR
  84.       msg : Message_Buffer ;
  85.       junk : integer ;
  86.  
  87.     BEGIN
  88.       junk := Get_Event( E_Button, 1, 1, 1, 0,
  89.                         false, 0, 0, 0, 0, false, 0, 0, 0, 0,
  90.                         msg, junk, junk, junk, junk, junk, junk ) ;
  91.       junk := Get_Event( E_Button, 1, 0, 1, 0,
  92.                         false, 0, 0, 0, 0, false, 0, 0, 0, 0,
  93.                         msg, junk, junk, junk, junk, junk, junk ) ;
  94.     END ;
  95.  
  96.   BEGIN
  97.     IF Init_Gem >= 0 THEN
  98.       BEGIN
  99.         s := 'nn mm This is a test-- xyzlq' ;
  100.         s[4] := chr( Get_Height DIV 10 + ord( '0' ) ) ;
  101.         s[5] := chr( Get_Height MOD 10 + ord( '0' ) ) ;
  102.         Draw_String( 20, 190, s ) ;
  103.         wait_button ;
  104.         FOR height := 2 TO 99 DO
  105.           BEGIN
  106.             Text_Height( height ) ;
  107.             s[1] := chr( height DIV 10 + ord( '0' ) ) ;
  108.             s[2] := chr( height MOD 10 + ord( '0' ) ) ;
  109.             s[4] := chr( Get_Height DIV 10 + ord( '0' ) ) ;
  110.             s[5] := chr( Get_Height MOD 10 + ord( '0' ) ) ;
  111.             Draw_String( 20, 190, s ) ;
  112.             wait_button ;
  113.           END ;
  114.         Exit_Gem ;
  115.       END ;
  116.   END.
  117.  
  118.  
  119.